﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework;
using Spelprojekt.Model;

namespace Spelprojekt.View
{
    class IntroView
    {
        Camera m_camera = new Camera();
        Color m_color = Color.White;
        public float m_timeToLive = 3.0f;


        public void Update(float a_elapsedTime)
        {
            m_timeToLive -= a_elapsedTime;
        }

        public void Draw(Spelprojekt.Model.Map a_map, SpriteBatch spriteBatch, GameAssets a_assets)
        {
            spriteBatch.Begin();

            if (m_timeToLive < 0.5f)
            {
                if (m_color.A >= 8)
                {
                    m_color.A -= 8;
                }
                else
                {
                    m_color.A = 0;
                }
            }


            int width = (int)(m_camera.m_scaleX * Map.g_width);
            int height = (int)(m_camera.m_scaleY * Map.g_height);

            Rectangle rect = new Rectangle(0, 0, width, height);



            //draw background
            spriteBatch.Draw(a_assets.m_background, rect, m_color);

            //draw text
            spriteBatch.DrawString(a_assets.m_font,
                                   String.Format("Level {0}:\n{1}",
                                   a_map.m_level, a_map.m_name),
                                   new Vector2(200, 200),
                                   m_color);

            spriteBatch.End();
        }
    }
}
